package com.woniu.microassetserver.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.microassetserver.mapper.PrincipalMapper;
import com.woniu.microassetserver.service.PrincipalService;
import com.woniu.microcommonsserver.entity.PrincipalEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Transactional(readOnly = true)
@Service
public class PrincipalServiceImpl implements PrincipalService {

    @Resource
    private PrincipalMapper principalMapper;

    @Override
    public PageInfo<PrincipalEntity> findAllByParams(int pageNum, int pageSize, PrincipalEntity principalEntity) {
        return PageHelper.startPage(pageNum,pageSize).
                doSelectPageInfo(()->principalMapper.findAllByParams(principalEntity));
    }
}
